#ifndef CIOPS_OP_CREATETORUS_H
#define CIOPS_OP_CREATETORUS_H

#include <strstream>

#include "Operation.h"

namespace CIOps {
    /**
     * This class represents the operation of creation of a torus   
     **/
    class OP_CreateTorus : public Operation {    

    public:            
        OP_CreateTorus (std::vector<CIView::View*>& v);     //Constructor
        virtual ~OP_CreateTorus();                          //Destructor

    protected:
        CIGeom::Geometry* torus;            //A pointer to the torus that will be added in the 3D scene
        CICore::Point topLeft;              //The torus top left bounding box coordinate
        float thickness;                    //The torus thickness  
        float radius;                       //The torus radius

        int stacks;                         //The number of stacks (for the torus subdivision in faces)
        int slices;                         //The number of slices (for the torus subdivision in faces)

        float rotation_x;                   //The torus x axis orientation
        float rotation_y;                   //The torus y axis orientation

        short torusDetail;                  //The torus tessellation detail

        //Methods for Triangles Tessellation of a torus
        void CreateTorusWithTriangles (int stacks, int slices, float thickness, float radius);
        void AddFace (int v1, int v2, int v3);               

    public:            
        //Utility Methods
        virtual int Exec();         //Method called to execute directly the operation
        virtual void Undo();        //Method called to undo the operation
        virtual void Redo();        //Method called to redo the operation

        virtual void MousePressEvent (CIView::View* view, QMouseEvent* e);        //Mouse Pressed event handler
        virtual void MouseReleaseEvent (CIView::View* view, QMouseEvent* e);      //Mouse Released event handler
        virtual void MouseMoveEvent (CIView::View* view, QMouseEvent* e);         //Mouse Moved event handler
        virtual void WheelEvent (CIView::View* view, QWheelEvent* e);             //Wheel event handler
    };
}

#endif /* CIOPS_OP_CREATETORUS_H */
